import java.io.*;
import java.util.*;

public class Main {
    private static Read in = new Read();
    private static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        String str = in.next();
        Stack<Character> result = new Stack<>();
        for (int i = 0;i < str.length();i++) {
            if (result.isEmpty()) {
                result.add(str.charAt(i));
            } else if (result.peek() == str.charAt(i)) {
                result.pop();
            } else {
                result.add(str.charAt(i));
            }
        }
        if (result.isEmpty()) {
            System.out.println(0);
        }
        StringBuilder sb = new StringBuilder();
        for (char s : result) {
            sb.append(s);
        }
        for (int i = 0;i < sb.length();i++) {
            System.out.print(sb.charAt(i));
        }
    }

    int[] dx = {0, 0, 1, -1};
    int[] dy = {1, -1, 0, 0};
    public int[][] highestPeak(int[][] isWater) {
        int m = isWater.length, n = isWater[0].length;
        int[][] height = new int[m][n];
        Queue<int[]> q = new LinkedList<>();
        for (int i = 0;i < m;i++) {
            Arrays.fill(height[i], -1);
        }
        for (int i = 0; i < m; i++) {
            for (int j = 0;j < n;j++) {
                if (isWater[i][j] == 1) {
                    height[i][j] = 0;
                    q.add(new int[]{i, j});
                }
            }
        }
        while (!q.isEmpty()) {
            int[] t = q.poll();
            int i = t[0], j = t[1];
            for (int k = 0;k < 4;k++) {
                int x = i + dx[k];
                int y = j + dy[k];
                if (x >= 0 && x < m && y >= 0 && y < n && height[x][y] == -1) {
                    height[x][y] = height[i][j] + 1;
                    q.add(new int[]{x, y});
                }
            }
        }
        return height;
    }

    public boolean canFinish(int numCourses, int[][] prerequisites) {
        int[] in = new int[numCourses];
        Map<Integer, ArrayList<Integer>> edges = new HashMap<>();
        for (int i = 0;i < prerequisites.length; i++) {
            int a = prerequisites[i][0];
            int b = prerequisites[i][1];
            if (!edges.containsKey(b)) {
                edges.put(b, new ArrayList<>());
            }
            edges.get(b).add(a);
            in[a]++;
        }
        Queue<Integer> q = new LinkedList<>();
        for (int i = 0; i < in.length;i++) {
            if (in[i] == 0) q.add(i);
        }
        while (!q.isEmpty()) {
            int t = q.poll();
            for (int a : edges.getOrDefault(t, new ArrayList<>())) {
                in[a]--;
                if (in[a] == 0) q.add(a);
            }
        }
        for (int i : in) {
            if (i != 0) return false;
        }
        return true;
    }

    public int[] getConcatenation(int[] nums) {
        int n = nums.length;
        int[] ret = new int[2 * n];
        for (int i = 0;i < n;i++) {
            ret[i] = nums[i];
            ret[i + n] = nums[i];
        }
        return ret;
    }

    public int[] shuffle(int[] nums, int n) {
        int[] ret = new int[2 * n];
        int k = 0;
        for (int i = 0;i < n;i++) {
            ret[k++] = nums[i];
            ret[k++] = nums[i + n];
        }
        return ret;
    }

    public int findMaxConsecutiveOnes(int[] nums) {
        int n = nums.length;
        int[] dp = new int[n];
        if (nums[0] == 1) dp[0] = 1;
        int ret = dp[0];
        for (int i = 1;i < n;i++) {
            if (nums[i] == 1) {
                dp[i] = dp[i - 1] + 1;
            }
            ret = Math.max(dp[i], ret);
        }
        return ret;
    }

    public int[] findOrder(int numCourses, int[][] prerequisites) {
        int[] in = new int[numCourses];
        Map<Integer, ArrayList<Integer>> edges = new HashMap<>();
        int[] ret = new int[numCourses];
        for (int i = 0;i < prerequisites.length;i++) {
            int a = prerequisites[i][0], b = prerequisites[i][1];
            if (!edges.containsKey(b)) {
                edges.put(b, new ArrayList<>());
            }
            edges.get(b).add(a);
            in[a]++;
        }
        Queue<Integer> q = new LinkedList<>();
        int pos = 0;
        for (int i = 0;i < numCourses;i++) {
            if (in[i] == 0) q.add(i);
        }
        while (!q.isEmpty()) {
            int t = q.poll();
            ret[pos++] = t;
            for (int a : edges.getOrDefault(t, new ArrayList<>())) {
                in[a]--;
                if(in[a] == 0) q.add(a);
            }
        }
        for (int i = 0;i < numCourses;i++) {
            if (in[i] != 0) return new int[]{};
        }
        return ret;
    }

    public List<String> generateParenthesis(int n) {
        List<String> ret = new ArrayList<>();
        backtrack(ret, new StringBuilder(), 0, 0, n);
        return ret;
    }

    public void backtrack(List<String> ret, StringBuilder cur, int open, int close, int n) {
        if (cur.length() == n * 2) {
            ret.add(cur.toString());
            return;
        }
        if (open < n) {
            cur.append("(");
            backtrack(ret, cur, open + 1, close, n);
            cur.deleteCharAt(cur.length() - 1);
        }

        if (close < open) {
            cur.append(")");
            backtrack(ret, cur, open, close + 1, n);
            cur.deleteCharAt(cur.length() - 1);
        }
    }

    public List<Integer> spiralOrder(int[][] matrix) {
        if (matrix.length == 0) return new ArrayList<Integer>();
        List<Integer> ret = new ArrayList<>();
        int l = 0, r = matrix[0].length - 1, t = 0, b = matrix.length - 1;
        while (true) {
            for (int i = l;i <= r;i++) ret.add(matrix[t][i]);
            if (++t > b) break;

            for (int i = t; i <= b;i++) ret.add(matrix[i][r]);
            if (--r < l) break;

            for (int i = r; i >= l;i--) ret.add(matrix[b][i]);
            if (--b < t) break;

            for (int i = b;i >= t;i--) ret.add(matrix[i][l]);
            if (++l > r) break;
        }
        return ret;
    }

    public boolean searchMatrix(int[][] matrix, int target) {
        int n = matrix.length, m = matrix[0].length;
        int x = 0, y = m - 1;
        while (x < n && y >= 0) {
            if (matrix[x][y] == target) {
                return true;
            }else if (matrix[x][y] > target) {
                y--;
            }else {
                x++;
            }
        }
        return false;
    }

    public boolean canPartition(int[] nums) {
        if (nums.length < 2) return false;
        int sum = 0;
        for (int i = 0;i < nums.length;i++) {
            sum += nums[i];
        }
        if (sum % 2 != 0) return false;
        boolean[] dp = new boolean[sum / 2 + 1];
        dp[0] = true;
        for (int i = 0;i < nums.length;i++) {
            int num = nums[i];
            for (int j = sum / 2;j >= num;j--) {
                dp[j] |= dp[j - num];
            }
        }
        return dp[sum / 2];
    }

    public int[] maxSlidingWindow(int[] nums, int k) {
        if (nums.length == 0 || k == 0) return new int[0];
        Deque<Integer> deque = new LinkedList<>();
        int[] res = new int[nums.length - k + 1];
        for (int i = 0;i < k;i++) {
            while (!deque.isEmpty() && deque.peekLast() < nums[i]) {
                deque.removeLast();
            }
            deque.addLast(nums[i]);
        }
        res[0] = deque.peekFirst();
        for (int i = k; i < nums.length;i++) {
            if (deque.peekFirst() == nums[i - k]) {
                deque.removeFirst();
            }
            while (!deque.isEmpty() && deque.peekLast() < nums[i]) {
                deque.removeLast();
            }
            deque.addLast(nums[i]);
            res[i - k + 1] = deque.peekFirst();
        }
        return res;
    }
}

class Read{
    StringTokenizer st = new StringTokenizer("");
    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

    public String next() throws IOException {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(bf.readLine());
        }
        return st.nextToken();
    }
}